

--------------------- 消除统计类((统计必备(事件回调:dicEvts, 数据:dicDatas
GPuzStatics = {dicDatas={},}

--这句是重定义元表的索引，必须要有，
GPuzStatics.__index = GPuzStatics
--模拟构造体，一般名称为new()
function GPuzStatics:new()
    local self = {}   
    setmetatable(self, GPuzStatics)   --必须要有
    
    self.dicDatas = {}
    
    self:init_round()
    
    return self  
end

function GPuzStatics:init_round()
    self.dicDatas = {}
    self.dicDatas[GSPuz_Cot] = 0
    self.dicDatas[GSPuz_PuzList] = {}
    self.dicDatas[GSPuz_PuzGems] = {}
    for _tpe, file in pairs(GemTypes) do
        self.dicDatas[GSPuz_PuzGems][_tpe] = 0
    end
end
    
function GPuzStatics:destroy()
end
    
function GPuzStatics:newRound()
    self:init_round()
end

function GPuzStatics:f_cot(n)
    if n == nil then
        n = 1
    end
    self.dicDatas[GSPuz_Cot] = self.dicDatas[GSPuz_Cot] + n
end
    
function GPuzStatics:f_puzlist(combo, tpe, sum)
    --self.dicDatas[GSPuz_PuzList].append((tpe, sum))
    local robj = {
        combo = combo,
        tpe = tpe,
        sum = sum,
    }
    --print(tpe,sum)
    table.insert(self.dicDatas[GSPuz_PuzList], robj)
    -- 统计所有宝石
    self:f_puzgems(tpe, sum)
end
    
function GPuzStatics:f_puzgems(tpe, sum)
    --print(tpe,sum)
    if self.dicDatas[GSPuz_PuzGems][tpe] == nil then
        self.dicDatas[GSPuz_PuzGems][tpe] = 0
    end
    self.dicDatas[GSPuz_PuzGems][tpe] = self.dicDatas[GSPuz_PuzGems][tpe] + sum
end

